<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<script type="text/javascript">
	var artMadeGrid = null;
	var editMadeDialog = null;
	var showMadeDialog=null;
	var showGS=null;
	$(function(){
		artMadeGrid = $("#art_Made_grid").ligerGrid({
				title : '发现艺术家列表',
                columns: [
							{
								display: '<a href="javascript:;" onclick="addArtist()">添加艺术家</a>', 
								name: 'id',
								width:400,
								isAllowHide: false, 
								isSort : false,
								render: function (record, rowindex, value, column){
									var html = '<a onclick="upateArtGS(\''+ value + '\')" href="javascript:;">修改</a>&nbsp;<a onclick="addArtPic(\''+ value + '\')" href="javascript:;">添加作品</a>&nbsp;<a onclick="showPicList(\''+ value + '\')" href="javascript:;">作品列表</a>&nbsp;<a onclick="displayArtist(\''+ value + '\')" href="javascript:;">显示</a>&nbsp;<a onclick="hideArtist(\''+ value + '\')" href="javascript:;">关闭</a>&nbsp;'; 
									return html; 
								}
							},
                     	 { display: '当前状态', name: 'isShow',isSort : false,
       	                  render: function(record, rowindex, value, column){
       	                	  if(value){
       	                		  return "<span>显示</span>"; 
       	                	  }else{
       	                		  return "<span>关闭</span>"; 
       	                	  }
       	                	 
       	                  }},
	                  { display: '艺术家', name: 'name',isSort : false },
	                  { display: '简介', name: 'detail',isSort : false},
                {
					display: '照片', 
					height:100,
					name: 'photo',
					isAllowHide: false, 
					isSort : false,
					render: function (record, rowindex, value, column){
						//alert(value);
						var html = '<img src="'+value+'_100x100" alt="" class="user_img"  width="100px" height="100px"/>'; 
						return html; 
					}
				},
                { display: '创建时间', name: 'gmtCreated',isSort : false,
                  render: function(record, rowindex, value, column){
                	 return (new Date(value.time)).format("yyyy年MM月dd日 hh:mm:ss");
                  }}
                
                ], 
                pageSize:30,
                root :'list',
                record:'totalRecord',
                url: "/misc/artFind/artFindGrid.htm", 
                width: '99%',height:'99%'
            });


	});
	//添加艺术家
	function addArtist(){
		editMadeDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artFind/addFindArtistWeb.htm", isResize: false ,modal:true,title:'添加艺术家'});
	
	}
	function upateArtGS(artistId){
		editMadeDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artFind/updateFindArtistWeb.htm?artistId="+artistId,  isResize: false ,modal:true,title:'修改艺术家'});
	
	}
	//作品列表
	function showPicList(artistId){
		showMadeDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/made/showPicList.htm?artistId="+artistId, isResize: false ,modal:true,title:'查看艺术家作品'});
	}
	//添加艺术家作品
	function addArtPic(artistId){
		addArtPicDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artFind/addFindArtPicWeb.htm?type=find&classId="+artistId,isResize: false ,modal:true,title:'添加作品'});
	}
	//开启 艺术家
	function displayArtist(id){
		$.post("/misc/artMade/updateArtist.htm", {
			id:id,
			isShow:true
		},function(data){
			if(data=="success"){
				artMadeGrid.loadData();
				$.ligerDialog.success("开启成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
	//关闭
	function hideArtist(id){
		$.post("/misc/artMade/updateArtist.htm", {
			id:id,
			isShow:false
		},function(data){
			if(data=="success"){
				artMadeGrid.loadData();
				$.ligerDialog.success("关闭成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
</script>
<div id="art_Made_grid" style="margin:0; padding:0 ;" ></div>
